<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div style="text-align: center">
    <form th:action="@{/getPage}" method="get">
        图书名称：<input type="text" name="name" th:value="${book.name}">
        图书类别：<input type="text" name="category" th:value="${book.category}">
        图书作者：<input type="text" name="author" th:value="${book.author}">
        <input type="submit" value="查询">
    </form>
</div>
<table border="1px" style="margin: auto">
    <tr>
        <th>编号</th>
        <th>书名</th>
        <th>价格</th>
        <th>类目</th>
        <th>库存</th>
        <th>图片</th>
        <th>说明</th>
        <th>作者</th>
        <th>已售</th>
    </tr>
    <tr th:each="b:${page.records}">
        <td th:text="${b.id}"></td>
        <td th:text="${b.name}"></td>
        <td th:text="${b.price}"></td>
        <td th:text="${b.category}"></td>
        <td th:text="${b.pnum}"></td>
        <td th:text="${b.imgurl}"></td>
        <td th:text="${b.description}"></td>
        <td th:text="${b.author}"></td>
        <td th:text="${b.sales}"></td>
    </tr>
    <tr style="text-align: center">
        <td colspan="9">
            总的页数：<span th:text="${page.pages}"></span>
            总的记录数：<span th:text="${page.total}"></span>
            当前页数：<span th:text="${page.current}"></span>
        </td>
    </tr>
    <tr style="text-align: center">
        <td colspan="9">
           <span th:if="${page.current>1}">
            <a th:href="@{/getPage(pageNum=${page.current -1})}">上一页</a>
            </span>

            <span th:each="p:${#numbers.sequence(1,page.pages)}">
            <a th:href="@{/getPage(pageNum=${p})}" th:text="${p}"></a>
            </span>

            <span th:if="${page.current<page.pages}">
              <a th:href="@{/getPage(pageNum=${page.current +1})}">下一页</a>
            </span>
        </td>
    </tr>
</table>
</body>
</html>